﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace FC_MFDs
{
    static class Program
    {
        // Signatures for unmanaged calls
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern bool SystemParametersInfo(
           int uAction, int uParam, ref int lpvParam,
           int flags);

        private const int SPI_SETSCREENSAVERACTIVE = 17;
        private const int SPIF_SENDWININICHANGE = 2;

        // Pass in TRUE(1) to activate or FALSE(0) to deactivate
        // the screen saver.
        public static void SetScreenSaverActive(int Active)
        {
            int nullVar = 0;

            SystemParametersInfo(SPI_SETSCREENSAVERACTIVE,
               Active, ref nullVar, SPIF_SENDWININICHANGE);
        }
        
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LeftMFCD leftMFCD = new LeftMFCD();
            RightMFCD rightMFCD = new RightMFCD();
            
            Main main = new Main();
            main.setLeftMFCD(leftMFCD);
            main.setRightMFCD(rightMFCD);

            SetScreenSaverActive(0);
            Application.Run(main);
            SetScreenSaverActive(1);
        }
    }
}
